home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 71 / MOBICLIC 71.ISO / mac / QuickTime6_Mac / pour MacOsX / QuickTime651.pkg / Contents / Resources / preflight < prev    next >
Text File  |  2004-03-18  |  2KB  |  91 lines

  1. #!/usr/bin/perl
  2.  
  3. #######################################
  4.  
  5. my $permissions_info_file = "/tmp/com.apple.installation.savedperm";
  6. my $target_disk = $ARGV[2];
  7. my @stat_info;
  8. my $MODE = 2;
  9. my $UID = 4;
  10. my $GID = 5;
  11.  
  12. if(! -e $permissions_info_file || (-e $permissions_info_file && unlink($permissions_info_file))) {
  13.     @stat_info = stat($target_disk);
  14.  
  15.     if(open(PERMS_FILE_HDL, ">$permissions_info_file")) {
  16.         print(PERMS_FILE_HDL join("\n", stat($target_disk)));
  17.         close(PERMS_FILE_HDL);
  18.         chmod(oct(700), "$permissions_info_file");
  19.     }
  20. }
  21.  
  22. ########################################
  23.  
  24. my $runnerPID = getppid();
  25. my $installerPID = "";
  26. my $uid = "";
  27. my $uname = "";
  28.  
  29. open( PSOUT, "/bin/ps -axww -o pid,ppid -p $runnerPID |" );
  30. while( <PSOUT> ) {
  31.     my @fields = split '\s+', $_;
  32.     if ("$fields[1]" eq "$runnerPID") {
  33.         $installerPID = $fields[2];
  34.     }
  35. }
  36. close( PSOUT );
  37.  
  38. if ("$installerPID" ne "") {
  39.     open( PSOUT, "/bin/ps -axww -o pid,ruid -p $installerPID |" );
  40.     while( <PSOUT> ) {
  41.         my @fields = split '\s+', $_;
  42.         if ("$fields[1]" eq "$installerPID") {
  43.             $uid = $fields[2];
  44.         }
  45.     }
  46.     close( PSOUT );
  47. }
  48.  
  49. if ("$uid" ne "") {
  50.     open( PSOUTA, "/usr/bin/id -p $uid |" );
  51.     while( <PSOUTA> ) {
  52.         my @fields = split '\s+', $_;
  53.         if ("$fields[0]" eq "uid") {
  54.             $uname = $fields[1];
  55.         }
  56.     }
  57.     close( PSOUTA );
  58. }
  59.  
  60. # Marketing (aka Amy Fazio) sez we don't need to bring up the registration dialog anymore
  61. # but let's just comment it out for now in case they change their minds. - duano! 3/16/04
  62. # ... see, QT BRB did change their minds on this. Putting it back until Gibson - duano! 3/17/04
  63. if ("$ENV{COMMAND_LINE_INSTALL}" ne "1") {
  64.     my $ALERT_APP = "$ARGV[0]" . "/Contents/Resources/QT6Installer.app/Contents/MacOS/QT6Installer";
  65.     my $EXIT_VALUE = 0;
  66.     
  67.     my $cmd = "\"$ALERT_APP\" -showregistration";
  68.     if ("$uname" ne "") {
  69.         $cmd = "sudo -u $uname \"$ALERT_APP\" -showregistration";
  70.     } 
  71.     
  72.     $EXIT_VALUE = system("$cmd");
  73.     
  74.     if (($EXIT_VALUE >> 8) != 0) {
  75.         if ("$installerPID" ne "") {
  76.             kill "QUIT", $installerPID;
  77.         }
  78.         kill "QUIT", $runnerPID;
  79.         exit($EXIT_VALUE >> 8);
  80.     }
  81. }
  82.  
  83. my $CLEANUP_PREFS = "$ARGV[0]" . "/Contents/Resources/CleanPrefs";
  84.  
  85. my $cmd = "\"$CLEANUP_PREFS\"";
  86. if ("$uname" ne "") {
  87.     $cmd = "sudo -u $uname \"$CLEANUP_PREFS\"";
  88. }
  89. system("$cmd");
  90.  
  91.